<template>
	<view class="Login white por">
		<view class="por logbox">
			<image src="../../static/login/login.png" class=" logpic"></image>
			<view class="color-white f24 poa logtxt text--center">{{i18n.hyjr}}</view>
		</view>
		<view class="mark" v-if="mark">
			<view class="tips">
				<view class="f18 white pt40 text--center px15 auto block my15">
					<text>{{i18n.fxxbb}}</text>
				</view>
				<view class="f16 hui wp80 auto">
					<text>{{i18n.zxbb}}V{{ version }}</text>
					<view class="" v-html="versionObj.remarks"></view>
				</view>
				<view class="btn-blue mt30 auto block mb30">
					<text @click="ToWeb(versionObj.url)">{{i18n.ljgx}}</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			mark: false,
			version:'',
			versionObj:{}
		};
	},
	computed: {
		i18n() {
			return this.$t('login');
		}
	},
	async onLoad() {
	
		if(!uni.getStorageSync('token')){
			uni.reLaunch({
				url:'/pages/Login/index'
			})
		}else{
			uni.switchTab({
				url:'../Home/index'
			})
		}
		this.getVersion()
		// let versions = await this.getVersion()
	},
	methods: {
		async getVersion(){
			let that = this
			let symstemName = ''
			// #ifdef APP-PLUS
			symstemName = plus.os.name
			symstemName = symstemName=='iOS'?symstemName.toUpperCase():symstemName
			// #endif
			// #ifdef H5
			symstemName = 'Android'
			// #endif
			let { data } = await that.$http.get('login.getAppVersion', {system:symstemName}, { isAuth: false, tipConfig: { isLoading: false } })
			that.version = data.number
			that.versionObj = data
			// #ifdef APP-PLUS
			plus.runtime.getProperty(plus.runtime.appid, wgtinfo => {
				if (wgtinfo.version != data.number) {
					this.mark = true;
				} else {
					this.mark = false;
					if(!uni.getStorageSync('token')){
						uni.reLaunch({
							url:'/pages/login/index'
						})
					}else{
						uni.switchTab({
							url:'../Home/index'
						})
					}
				}
			});
			// #endif
		},
		ToWeb(e) {
			plus.runtime.openURL(e);
		},
	}
};
</script>

<style lang="less">
.Login {
	width: 100%;
	min-height: 100vh;
	.logbox{
		width: 100%;
		height: 984rpx;
	}
	.logtxt{
		width: 100%;
		bottom: 200rpx;
	}
	.logpic{
		width: 100%;
		height: 984rpx;
	}
}
.lang {
	position: fixed;
	right: 30rpx;
	top: 100rpx;
}
.langer {
	position: absolute;
	right: 0;
	top: 97%;
	line-height: 48rpx;
}
.borders {
	border: 1rpx solid rgba(151, 151, 151, 0.6);
	border-radius: 4rpx;
}
.choice {
	border-bottom: none !important;
}
.choices {
	border-top: none !important;
}
.box {
	width: 160rpx;
}
.f27 {
	font-size: 56rpx;
}
.w564 {
	width: 564rpx;
	margin: 70rpx auto 0;
}
.tips {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 612rpx;
	// height: 586rpx;
	background: #222939;
	border-radius: 16rpx;
	image {
		position: absolute;
		right: 30rpx;
		top: 30rpx;
		width: 48rpx;
		height: 48rpx;
		display: block;
	}
}
</style>
